package top.suven.base.core.mq.activemq;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/** 
 * @ClassName: MessageProducer 
 * @Description: TODO(这里用一句话描述这个类的作用) 
 * @author Carson yuchanghong@tydic.com 
 * @date 2015-4-30 上午9:49:56 
 *  
 */
@Component
public class MessageProducer {
	private Logger logger = LoggerFactory.getLogger(MessageProducer.class);
	@Resource
	private JmsMessagingTemplate jmsMessagingTemplate;

	//发送消息
	public void sendMessage(String queueName,Object message){
		logger.info(String.format("activeMq send message queueName=%s,msg=%s", queueName,String.valueOf(message)));
		ActiveThreadMq activeThreadMq = new ActiveThreadMq(jmsMessagingTemplate, queueName, message);
		new Thread(activeThreadMq).start();
	}
    
}
